#ifndef _HTTPWARPRESP_H_
#define _HTTPWARPRESP_H_

#include "http_parser.h"
#include "http_header.hpp"

#define http_response 1
#define http_request  0

class CHttpParser
{
public:
    CHttpParser();
    virtual ~CHttpParser();

    int http_init_analyze(int type);

    int http_analyze(char* p, size_t ilen);
    virtual void on_http_message_begin();
    virtual void on_http_status(const char* at, size_t length);
    virtual void on_http_url(const char* at, size_t length);
    virtual void on_http_header_field(const char* at, size_t length);
    virtual void on_http_header_value(const char* at, size_t length);
    virtual void on_http_header_complete();
    virtual void on_http_body(const char* at, size_t length);
    virtual void on_http_message_complete();
    virtual void on_http_chunk_header();
    virtual void on_http_chunk_complete();
    int isConnectKeeplive();

public:
    http_parser* m_parser;

protected:
    http_parser_settings m_httpcb;
};

#endif
